var countDown = 60,
    setCountDown = function () {
        var t = $("#vcodeBtn");
        if (0 === countDown) return t.attr("disabled", !1),
            t.text("获取验证码"),
            countDown = 60,
            !1;
        t.attr("disabled", !0),
            t.text("(" + countDown + ")秒"),
            countDown-- ,
            setTimeout(function () {
                setCountDown()
            },
                1e3)
    };
$("#vcodeBtn").on("click",
    function () {
        var t = $("#phone_num").val();
        t && /1\d{10}/.test(t) ? ($.ajax({
            method: "post",
            url: hostUrl + "/code/passVcode",
            contentType: "application/json; charset=utf-8",
            data: '{\n"phone_num": "' + t + '"}',
            success: function (t) {
                !0 !== t.meta.success ? $.toptip(t.meta.message, "error") : $.toptip("重置密码的验证码已发送到您的手机上，请查收！", "success")
            }
        }), setCountDown()) : $.toptip("请输入11位手机号")
    }),
    $("#restPass").on("click",
        function () {
            var t = $("#phone_num").val();
            t && /1\d{10}/.test(t) ? $.ajax({
                method: "post",
                url: hostUrl + "/customer/resetPass",
                contentType: "application/json; charset=utf-8",
                data: JSON.stringify({
                    "type": 1,
                    "mobile": t
                }),
                success: function (t) {
                    !0 !== t.meta.success ? $.toptip(t.meta.message, "error") : ($.toptip("重置密码的密码已发送到您的手机上，请查收！", "success"), setTimeout(function () {
                        location.hash = "login"
                    },
                        1e3))
                }
            }) : $.toptip("请输入11位手机号")
        });